﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="redirectcachemgmt.aspx.cs" Inherits="Redirection.Layouts.Redirection.redirectcachemgmt" DynamicMasterPageFile="~masterurl/default.master" %>

<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
    Redirection Cache Management
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
    Site Redirection Cache Management
</asp:Content>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
    <style type="text/css">
        
        #contentBox {
            float: left;
            margin-left: 0;
        }

        .cacheContainer {
            clear: both;
            float: left;
            width: 100%;
        }

        .cacheContainer h2 {
            font-size: 25px;
            padding: 5px 0;
        }

        .fullWidth {
            clear: both;
            float: left;
            width: 100%;
        }

        .cacheExpired span {
            float: left;
            margin-right: 10px;
            margin-top: 2px;
        }

        .cacheExpired input { float: left; }

        .cacheRedirection span {
            clear: both;
            float: left;
            margin-bottom: 10px;
        }

        .cacheRedirection table {
            float: left;
            width: 100%;
        }

        .cacheRedirection table td, .cacheRedirection table td { padding: 3px 5px; }

        .management { margin-bottom: 10px; }

        .actionButtons {
            clear: both;
            float: left;
            margin-top: 15px;
            width: 100%;
        }

        .actionButtons input[type="submit"] { margin-left: 0; }

        .validation {
            color: red;
            padding: 8px 0;
        }

        .requiredField {
            color: red;
            margin-left: 4px;
            margin-top: 0;
        }
    </style>
</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <asp:Panel runat="server" ID="_pnlError">
        <div class=".validation">
            You do not have permission to view this page.
        </div>
        <div class="actionButtons">
            <asp:Button ID="Button2" runat="server" Text="Go Back" OnClick="Cancel_OnClick" CausesValidation="False" />
        </div>
    </asp:Panel>
     <asp:Panel runat="server" ID="_pnlDisabled" Visible="False">
        <div class=".validation">
            Redirection has been disabled
        </div>
        <div class="actionButtons">
            <asp:Button ID="Button3" runat="server" Text="Go Back" OnClick="Cancel_OnClick" CausesValidation="False" />
        </div>
    </asp:Panel>
    <asp:Panel runat="server" ID="_pnlContent" Visible="False">
        
        <div class="cacheContainer">
            <div class="fullWidth management">
                <asp:Label ID="Label2" runat="server" Text="Cache Creation: "></asp:Label><asp:Literal runat="server" ID="_ltCreationDate"></asp:Literal>
            </div>
            <div class="fullWidth cacheExpired">
                <asp:Panel runat="server" ID="_pnlRecords">
                    <h2>Item Update Polling</h2>
                    <asp:Label ID="Label1" runat="server" Text="Polling Interval(seconds)"></asp:Label><asp:TextBox runat="server" ID="_txtCacheExpiration"></asp:TextBox>
                    <span class="requiredField">
                        <asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="BulletList" EnableClientScript="True" ShowSummary="False" />
                    </span>

                    <asp:RequiredFieldValidator Text="*" runat="server" ControlToValidate="_txtCacheExpiration" ID="_vldRequiredCacheExpiry" ErrorMessage="Cache Expiry cannot be empty" Display="Dynamic"></asp:RequiredFieldValidator>
                    <asp:CompareValidator Text="*" runat="server" Type="Integer" Operator="DataTypeCheck" ControlToValidate="_txtCacheExpiration" ID="_vldCmpTypeIntCacheExpiry" ErrorMessage="Cache Expiry must be a valid number" Display="Dynamic"></asp:CompareValidator>
                    <asp:RangeValidator Text="*" ID="RangeValidator1" runat="server" Type="Integer" ControlToValidate="_txtCacheExpiration" MinimumValue="10" MaximumValue="86400" ErrorMessage="Cache expiry must be between 10-86400 seconds" Display="Dynamic"></asp:RangeValidator>

                    <div class="fullWidth validation">
                        <asp:ValidationSummary runat="server" DisplayMode="BulletList" EnableClientScript="True" ShowValidationErrors="True" ValidationGroup="cacheTime" />
                    </div>
                </asp:Panel>
            </div>
            <div class="fullWidth cacheRedirection">
                <h2>Cached Redirections</h2>
                <asp:Label runat="server" ID="_lblNumberOfRecords" Text="Record Count: "></asp:Label><asp:Literal runat="server" ID="_ltNumberOfRecords"></asp:Literal>
                <asp:GridView runat="server" ID="_grdRedirections" AutoGenerateColumns="False">
                    <Columns>
                        <asp:BoundField DataField="Source" HeaderText="Source Url" />
                        <asp:BoundField DataField="Destination" HeaderText="Destination Url" />
                        <asp:BoundField DataField="IsPermanent" HeaderText="Is Permanent Redirect" />
                    </Columns>
                </asp:GridView>
            </div>
            <div class="fullWidth management">
                <h2>Clear Cache</h2>
                <asp:Label runat="server" Text="Clear Cache on Server: "></asp:Label><asp:CheckBox runat="server" ID="_chkClear"/>
            </div>
            <div class="actionButtons">
                <asp:Button runat="server" Text="Save" OnClick="Save_OnClick" />
                <asp:Button ID="Button1" runat="server" Text="Cancel" OnClick="Cancel_OnClick" CausesValidation="False" />
            </div>
        </div>
    </asp:Panel>
</asp:Content>